package com.zyz.LayoutPane;

import javafx.scene.control.Button;
import javafx.scene.layout.VBox;

public class VBoxLayout extends VBox {
    public VBoxLayout() {
        super(10); // spacing = 10

        // 创建按钮
        Button btn1 = new Button("按钮 1");
        Button btn2 = new Button("按钮 2");
        Button btn3 = new Button("按钮 3");

        // 添加点击事件监听器
        btn1.setOnAction(e -> System.out.println("按钮 1 被点击了！"));
        btn2.setOnAction(e -> System.out.println("按钮 2 被点击了！"));
        btn3.setOnAction(e -> System.out.println("按钮 3 被点击了！"));

        // 添加到布局中
        this.getChildren().addAll(btn1, btn2, btn3);
    }
}
